#ifndef _TRACKLAYER_H_
#define _TRACKLAYER_H_
#include "cocos2d.h"
#include "BackGround.h"
#include "SourceNum.h"
//#define SINGLENUMS 3
//#define COUPLENUMS 2
//#define THREENUMS 3
//
//#define SINGLE_TEXTURE_WIDTH 2048
//#define SINGLE_TEXTURE_HEIGHT 1536
//
//#define  TRACKSPRITESNUMS  (SINGLENUMS+COUPLENUMS*2+THREENUMS*3)


struct SpriteNum{
	int anum;
	int bnum;
	int cnum;

	int abnum;
	int abcnum;

	int abnums;
	int abcnums;
};

class TrackLayer : public cocos2d::CCLayerColor
{
private:

	SpriteNum sNum;
	int ic;

	int nextStyle;
	int preNum;
	int nextNum;

	int *index;

	std::string trackString;

	std::string pngString ;
	cocos2d::CCSize winSize;
	cocos2d::CCSprite *sprites[TRACKSPRITESNUMS];
	struct ShowList *showList;


	bool isSecend(int);
	int getNextNum();
	int converToBox2DNum(int i);
	void initNums();
	void initIndex();
	void loadTexture();
	void initPosition();
	void initData();
	void updateShowSprites(struct ShowList *pShow,float n);

	void backgroundMove(float xlength);
	//void spriteMoveY(float ylength);
	//void spriteMoveX(float xlength);
	//void move(float x,float y);

	cocos2d::CCSprite *getNextSprite();

	cocos2d::CCSprite *realSprite;
public:
	void draw();
	TrackLayer(std::string trackstring);
	~TrackLayer(void);
};
#endif

